(function webpackUniversalModuleDefinition(root, factory) {
    if (typeof exports === 'object' && typeof module === 'object')
        module.exports = factory();
    else if (typeof define === 'function' && define.amd)
        define([], factory);
    else if (typeof exports === 'object')
        exports["FPHDSdk"] = factory();
    else
        root["FPHDSdk"] = factory();
})(this, function () {
    return (function (modules) {

        var installedModules = {};

        function __webpack_require__(moduleId) {

            // Check if module is in cache
            if (installedModules[moduleId]) {
                return installedModules[moduleId].exports;
            }

            // Create a new module (and put it into the cache)
            var module = installedModules[moduleId] = {
                exports: {},
                id: moduleId,
                loaded: false
            };

            // Execute the module function
            modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

            // Flag the module as loaded
            module.loaded = true;

            // Return the exports of the module
            return module.exports;
        }

        // expose the module cache
        __webpack_require__.c = installedModules;

        // __webpack_public_path__
        __webpack_require__.p = "/assets/";

        // Load entry module and return exports
        return __webpack_require__(0);
    })([

        function (module, exports, __webpack_require__) {

            'use strict';

            // 是否使用网页端的底下向上滑分享框， true 使用，false 使用app原生的
            var isUseWebBottomSheet = true;

            var FPHDSdkUserInfoKey = 'FPHDSdkUserInfo';
            var channelId;
            var isPayLogin;
            var loginType;
            var qrCodeSessionId;
            var loginCallbackFun;
            var baseElementId = 'FPHDLogin';
            var apiServerUrl = '';
            var _qrCodeLoginTimer = 0;
            var isAdmin = false;
            var loadedJsFiles = {};
            var weixinJsConfig = {};
            var platFormUserInfo = {};
            var listenerList = {};
            var gaodeKey = 'd63c9bad74fafd6e29e4765bc7afac62';
            var qqMapKey = 'WJ6BZ-QXCKK-32VJT-A62EP-VTGQK-6NFR7';
            var qqMapAppName = '本地玩-用户端';
            var domainConfig = {
                1004: location.host, // 三哥玩
                1014: location.host, // 贵港玩
                1005: location.host, // 蚌埠玩
                1023: location.host, // 大圣玩
                1008: location.host,
                1009: location.host, // 贺州玩
                1010: location.host, // 梧州玩
                1013: location.host, // 来宾玩
                1015: location.host, // 柳州玩
                // 1016:'uc.knightcapital.cn', // 暂不使用
                1017: location.host, // 广西老友玩
                1018: location.host, //  海港玩
                1029: location.host, // 桔子游玩
                1033: location.host, // 湛江玩
                //1011:'uc.hi-fangpian.com', // 芒果游玩
                1011: location.host, // 芒果游玩
                1046: location.host, // 瓜子
                1047: location.host, // 香城玩的支付渠道
                1045: location.host,
                1048: location.host,
                1049: location.host,
                1043: location.host,
                1044: location.host,
            };

            var weixinJsFiles = [
                'https://res.wx.qq.com/open/js/jweixin-1.4.0.js'
            ];

            // 引入高德sdk
            var amapLocationInfo = {};
            var notPhoneLoginChannelId = [
                '1045',
                '1048',
                '1008',
                '1032'
            ];

            var tempTime = new Date().getTime();
            var stopDomain = 'https://hall.51fpyouxi.cn/stop.html?v=' + tempTime;
            module.exports = {

                loadJs: function loadJs(scripts, callback) {

                    if (typeof (scripts) != "object") var scripts = [scripts];
                    var haveLoaded = true;
                    for (var i = 0; i < scripts.length; i++) {
                        if (!loadedJsFiles[scripts[i]]) {
                            haveLoaded = false;
                            loadedJsFiles[scripts[i]] = 1;
                        }
                    }

                    if (haveLoaded) {
                        callback();
                        return;
                    }
                    var HEAD = document.getElementsByTagName("head").item(0) || document.documentElement;
                    var s = new Array(), last = scripts.length - 1, recursiveLoad = function (i) {
                        s[i] = document.createElement("script");
                        s[i].setAttribute("type", "text/javascript");
                        s[i].onload = s[i].onreadystatechange = function () { //Attach handlers for all browsers
                            if (!0 || this.readyState == "loaded" || this.readyState == "complete") {
                                this.onload = this.onreadystatechange = null;
                                this.parentNode.removeChild(this);
                                if (i != last) recursiveLoad(i + 1); else callback();
                            }
                        }
                        s[i].setAttribute("src", scripts[i]);
                        HEAD.appendChild(s[i]);
                    };
                    recursiveLoad(0);
                },

                getAllParam: function getAllParam() {
                    var url = window.location.search || window.location.href || window.location.hash;
                    var theRequest = new Object();
                    if (url.indexOf("?") != -1) {
                        //var str = url.substr(1);
                        var str = url.split("?")[1];
                        if (str.indexOf("&") != -1) {
                            var strs = str.split("&");
                            for (var i = 0; i < strs.length; i++) {
                                var tmpStrs = strs[i].split("=");
                                if (tmpStrs.length > 2) {
                                    var string = strs[i].split(tmpStrs[0] + "=");
                                    if (string[1].indexOf("#") != -1) {
                                        theRequest[tmpStrs[0]] = string[1].split("#")[0];
                                    } else {
                                        theRequest[tmpStrs[0]] = string[1];
                                    }
                                } else {
                                    if (tmpStrs[1].indexOf("#") != -1) {
                                        theRequest[tmpStrs[0]] = tmpStrs[1].split("#")[0];
                                    } else {
                                        theRequest[tmpStrs[0]] = tmpStrs[1];
                                    }
                                }
                            }
                        } else {
                            if (str.indexOf("=") != -1) {
                                var tmpStrs = str.split("=");
                                if (tmpStrs[1].indexOf("#") != -1) {
                                    theRequest[tmpStrs[0]] = tmpStrs[1].split("#")[0];
                                } else {
                                    theRequest[tmpStrs[0]] = tmpStrs[1];
                                }
                            }
                        }
                    }

                    return theRequest;
                },
                getDoMian: function getDoMian(channelId) {
                    alert(channelId)
                    return domainConfig[channelId];
                },
                getBrowserType: function getBrowserType() {

                    var ua = navigator.userAgent.toLowerCase();

                    if (ua.match(/MicroMessenger/i) == "micromessenger") {
                        return 'weixin';
                    } else if (ua.match(/mqqbrowser/i) == "mqqbrowser") {
                        return 'qq';
                    } else if (ua.indexOf('xlmessenger') != -1) {
                        return 'xl';
                    } else if (ua.search('bendiwan') != -1) {
                        return 'fphdNewApp';
                    } else if (ua.search('fphdbdwmessenger') != -1) {
                        return 'fphdApp';
                    } else if (ua.search('fpmessenger') != -1) {
                        return 'fphdOldApp';
                    } else if (ua.match(/chrome/i) == "chrome") {
                        return 'chrome';
                    } else {
                        return 'any';
                    }
                },

                getHeight: function getHeight() {
                    var winHeight = 0;
                    //获取窗口高度
                    if (innerHeight) {
                        winHeight = innerHeight;
                    } else if ((document.body) && (document.body.clientHeight)) {
                        winHeight = document.body.clientHeight;
                    }
                    //通过深入Document内部对body进行检测，获取窗口大小
                    if (document.documentElement && document.documentElement.clientHeight) {
                        winHeight = document.documentElement.clientHeight;
                    }
                    return winHeight;
                },

                getWidth: function getWidth() {
                    var winWidth = 0;
                    //获取窗口宽度
                    if (innerWidth) {
                        winWidth = innerWidth;
                    } else if ((document.body) && (document.body.clientWidth)) {
                        winWidth = document.body.clientWidth;
                    }
                    //通过深入Document内部对body进行检测，获取窗口大小
                    if (document.documentElement && document.documentElement.clientWidth) {
                        winWidth = document.documentElement.clientWidth;
                    }
                    return winWidth;
                },

                addCookie: function addCookie(name, value, expiresHours) {

                    var cookieString = name + "=" + encodeURIComponent(value);
                    //设置cookie时间
                    if (expiresHours > 0) {
                        var date = new Date();
                        date.setTime(date.getTime + expiresHours * 3600 * 1000);
                        cookieString = cookieString + "; expires=" + date.toGMTString() + "; path=/;";
                    }
                    document.cookie = cookieString;

                    if (localStorage) {
                        localStorage[name] = value;
                    }

                },

                getCookie: function getCookie(name) {
                    var strCookie = document.cookie;
                    var arrCookie = strCookie.split("; ");
                    for (var i = 0; i < arrCookie.length; i++) {
                        var arr = arrCookie[i].split("=");
                        if (arr[0] == name) {
                            cookieVal = decodeURIComponent(arr[1]);
                            return cookieVal;
                        }
                    }
                    if (localStorage) {
                        var cookieVal = localStorage[name];
                        if (cookieVal != undefined) {
                            cookieVal = decodeURIComponent(cookieVal);
                            return cookieVal;
                        }
                    }

                    return "";
                },

                delCookie: function delCookie(name) {

                    var exp = new Date();
                    exp.setTime(exp.getTime() - 1);
                    var cval = FPHDSdk.getCookie(name);
                    if (cval) {
                        document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ";path=/;";
                        document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ";path=/hall;";
                    }

                    if (localStorage) {
                        localStorage.removeItem(name);
                    }
                },

                addSessionStorage: function addSessionStorage(name, value) {

                    var storage = window.sessionStorage;
                    if (storage) {
                        storage.setItem(name, value);
                    }
                },

                getSessionStorage: function getSessionStorage(name) {

                    var value = '';
                    var storage = window.sessionStorage;
                    if (storage) {
                        value = storage.getItem(name);
                    }

                    return value;
                },

                sendUrl: function sendUrl(postUrl, onResult) {
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            try {
                                var dataObj = eval("(" + data.response + ")");//转换为json对象
                                onResult(dataObj);
                            } catch (e) {
                            }

                        },
                        onFail: function () {
                            onResult(false);
                        }
                    });
                },

                doGet: function doGet(obj) {

                    var url = obj.url;
                    var onSuccess = obj.onSuccess;
                    if (!url) {
                        console.error("no url");
                        return;
                    }
                    if (!onSuccess) {
                        console.error("no onSuccess");
                        return;
                    }

                    var xhr = new XMLHttpRequest();
                    var urlArr = url.split("?");
                    if (obj.requestMethod == 'GET') {
                        if (urlArr[1]) {
                            xhr.open("GET", urlArr[0], true);
                            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                            xhr.send(urlArr[1]);
                        } else {
                            xhr.open("GET", url, true);
                            xhr.send();
                        }
                    } else {
                        if (urlArr[1]) {
                            xhr.open("POST", urlArr[0], true);
                            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                            xhr.send(urlArr[1]);
                        } else {
                            xhr.open("POST", url, true);
                            xhr.send();
                        }
                    }

                    xhr.onreadystatechange = function () {
                        if (xhr.readyState == 4) {
                            if (xhr.status >= 400 || xhr.status == 0) {
                                console.error("404:" + url);
                            }
                            else {
                                var data = { "response": xhr.responseText };
                                onSuccess(data);
                            }
                        }
                    };
                },

                dataIsNull: function dataIsNull(data) {
                    if (typeof data == "undefined" || data == null || data == '' || (typeof data === "object" && (data instanceof Array) && data.length == 0)) {
                        return true;
                    } else {
                        if (typeof data === "object" && !(data instanceof Array)) {
                            var hasProp = false;
                            for (var prop in data) {
                                hasProp = true;
                                break;
                            }
                            if (!hasProp) {
                                return true;
                            }
                        }
                        return false;
                    }
                },

                getSystemType: function getSystemType() {

                    var systemType = '';
                    var storage = window.sessionStorage;
                    if (storage) {
                        systemType = storage.getItem("fphdSystemType");
                    }

                    var params = FPHDSdk.getAllParam();
                    if (/(miniprogram)/i.test(navigator.userAgent) || systemType == 'miniprogram' || (params['systemType'] && params['systemType'] == 'miniprogram')) {
                        if (storage) {
                            storage.setItem("fphdSystemType", "miniprogram");
                        }
                        return 'miniprogram';
                    } else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                        return "ios";
                    } else if (/(Android)/i.test(navigator.userAgent)) {
                        return "android";
                    } else {
                        return "web";
                    }
                },

                /**
                 * 添加事件监听
                 * @param type
                 * @param listener
                 */
                addEventListener: function addEventListener(type, listener) {

                    if (type && listener) {
                        listenerList[type] = listener;
                    }

                    console.log('addEventListener');
                    console.log(type);
                    console.log(listener);
                },

                /**
                 * 登录
                 * @param json
                 * @param callback
                 */
                login: function login(json, callback) {
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };
                    if (!json || !json.channelId) {
                        callback(returnData);
                        return;
                    }
                    json.isRefresh = json.isRefresh == true ? true : undefined;
                    channelId = json.channelId;
                    isPayLogin = FPHDSdk.dataIsNull(json.isPayLogin) ? 0 : 1;
                    loginCallbackFun = callback;

                    // 初始化接口域名
                    FPHDSdk._initApi(channelId);
                    if (!apiServerUrl) {
                        returnData['msg'] = '域名解析失败';
                        callback(returnData);
                        return;
                    }

                    // 读取浏览器类型，判断是否是在浏览器内打开
                    var browserType = FPHDSdk.getBrowserType();
                    var params = FPHDSdk.getAllParam();

                    // 客户端指定登录方式则采用客户端的代理方式
                    // 如果是在微信内打开，则使用微信网页授权登录方式，否则使用二维码扫码登录方式
                    loginType = 'qrCode';
                    if (browserType == 'weixin') {

                        FPHDSdk.setWeixinJsConfig();
                        // 限定渠道登录方式
                        loginType = 'web';
                    } else if (browserType == 'xl') {
                        loginType = 'phone';
                    } else if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                        loginType = 'fphdAppLogin';
                    } else {
                        if (!FPHDSdk.dataIsNull(json.login)) {
                            loginType = json.login;
                        }
                    }

                    // 限定渠道手机号登录
                    if (browserType != 'weixin' && notPhoneLoginChannelId.indexOf(channelId) == -1) {
                        loginType = 'phone';
                    }

                    // 处理管理后台登录
                    if (!FPHDSdk.dataIsNull(json.isAdmin)) {
                        loginType = 'qrCode';
                        isAdmin = true;
                    }

                    // 小程序需要区分本地玩的小程序和店铺独立的小程序
                    var FPHDSdkLastLoginSystemType = FPHDSdk.getCookie('FPHDSdkLastLoginSystemType');
                    var systemType = FPHDSdk.getSystemType();
                    if (systemType == 'miniprogram' && !FPHDSdk.dataIsNull(params['appId'])) {
                        FPHDSdk.delCookie(FPHDSdkUserInfoKey);
                    } else if (systemType == 'miniprogram' && params['sessionId']) {
                        FPHDSdk.delCookie(FPHDSdkUserInfoKey);
                    } else if (FPHDSdkLastLoginSystemType != systemType) {
                        FPHDSdk.delCookie(FPHDSdkUserInfoKey);
                    }

                    FPHDSdk.addCookie('FPHDSdkLastLoginSystemType', systemType);
                    var FPHDSdkUserInfo = FPHDSdk.getCookie(FPHDSdkUserInfoKey);
                    FPHDSdkUserInfo = decodeURIComponent(FPHDSdkUserInfo);
                    var FPHDSdkUserInfos = FPHDSdkUserInfo.split("||");

                    // 跨渠道登录需要重新微信授权
                    if ((!FPHDSdk.dataIsNull(params['channelId']) && params['channelId'] != channelId)) {
                        FPHDSdkUserInfo = false;
                        channelId = params['channelId'];

                        FPHDSdk.addCookie('HALLCHANNELID', channelId, 86400);
                    }

                    if ((FPHDSdkUserInfo && FPHDSdkUserInfos[2] != channelId) || FPHDSdk.dataIsNull(FPHDSdkUserInfos[3])) {
                        FPHDSdkUserInfo = false;
                    }

                    if (params['debug'] == 1 && params['token']) {
                        FPHDSdk._debugTokenLogin();
                        return;
                    }

                    var token = FPHDSdk._getOldCookie();
                    if (!FPHDSdk.dataIsNull(token) && json.isRefresh == undefined) {
                        FPHDSdk._oldTokenLogin(token);
                        return;
                    }

                    // 清除老的token
                    FPHDSdk.delCookie('HALLCHANNELID');
                    FPHDSdk.delCookie('HALLTOKEN');
                    FPHDSdk.delCookie('token');
                    if (FPHDSdkUserInfo && json.isRefresh == undefined) {
                        FPHDSdk._tokenLogin();
                        return;
                    }

                    var secretKey = FPHDSdk._getSecretKey();
                    if (!FPHDSdk.dataIsNull(secretKey)) {
                        FPHDSdk._secretKeyLogin(secretKey);
                        return;
                    }

                    // 小程序登录
                    if (systemType == 'miniprogram' && params['sessionId']) {
                        FPHDSdk._miniprogramLogin();
                        return;
                    }

                    // 区分登录方式
                    if (loginType == 'web') {
                        FPHDSdk._wechatLogin();
                    } else if (loginType == 'qrCode') {
                        FPHDSdk._qrCodeLogin();
                    } else if (loginType == 'phone') {
                        FPHDSdk._phoneLogin();
                    } else if (loginType == 'fphdAppLogin') {

                        if (browserType == 'fphdNewApp') {
                            FPHDSdk._appNewLogin();
                        } else {
                            FPHDSdk._appLogin();
                        }
                    } else {
                        // 展示选择页面
                        FPHDSdk._selectLogin();
                    }

                    return;
                },

                /**
                 * 是否显示底部菜单
                 * @returns {boolean}
                 */
                showNavbar: function showNavbar() {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdNewApp' || browserType == 'fphdNewApp') {
                        return false;
                    }

                    return true;
                },

                /**
                 * app获取用户信息
                 * @returns {{code: number, msg: string}}
                 */
                getUserInfo: function getUserInfo() {

                    var returnData = { code: 1001, msg: "用户未登录" };

                    if (platFormUserInfo) {
                        returnData = { code: 0, msg: "success", data: platFormUserInfo };
                    }

                    return returnData;
                },

                setWeixinJsConfig: function setWeixinJsConfig() {

                    // 初始化微信js sdk 配置信息
                    FPHDSdk.loadJs(weixinJsFiles, function () {

                        var postUrl = apiServerUrl + "/weChat/getJsConfig?channelId=" + channelId;

                        // 检测用户登录的session是否过期
                        FPHDSdk.doGet({
                            url: postUrl,
                            onSuccess: function (data) {
                                var dataObj = eval("(" + data.response + ")");//转换为json对象
                                if (dataObj.code !== 0) {
                                    FPHDSdk.showTips(dataObj.msg);
                                    return;
                                }

                                console.log('获取微信配置信息：', dataObj);

                                weixinJsConfig = {
                                    debug: dataObj.data.debug,
                                    appId: dataObj.data.appId,
                                    nonceStr: dataObj.data.nonceStr,
                                    timestamp: dataObj.data.timestamp,
                                    signature: dataObj.data.signature,
                                    jsApiList: []
                                };

                                /*
                                jsApiList: [
                                    "checkJsApi",
                                    "onMenuShareTimeline",
                                    "onMenuShareAppMessage",
                                    "onMenuShareQQ",
                                    "onMenuShareWeibo",
                                    "onMenuShareQZone",
                                    "hideMenuItems",
                                    "showMenuItems",
                                    "hideAllNonBaseMenuItem",
                                    "showAllNonBaseMenuItem",
                                    "translateVoice",
                                    "startRecord",
                                    "stopRecord",
                                    "onVoiceRecordEnd",
                                    "playVoice",
                                    "onVoicePlayEnd",
                                    "pauseVoice",
                                    "stopVoice",
                                    "uploadVoice",
                                    "downloadVoice",
                                    "chooseImage",
                                    "previewImage",
                                    "uploadImage",
                                    "downloadImage",
                                    "getNetworkType",
                                    "openLocation",
                                    "getLocation",
                                    "hideOptionMenu",
                                    "showOptionMenu",
                                    "closeWindow",
                                    "scanQRCode",
                                    "chooseWXPay",
                                    "openProductSpecificView",
                                    "addCard",
                                    "chooseCard",
                                    "openCard"
                                ]
                                // */
                            },
                            onFail: function () {
                                FPHDSdk.showTips("请求服务器失败");
                            }
                        });
                    });

                },

                _getOldCookie: function _getOldCookie() {

                    // 老渠道才从老cookie里面取数据
                    if (notPhoneLoginChannelId.indexOf(channelId) == -1) {
                        var strCookie = document.cookie;
                        var arrCookie = strCookie.split("; ");
                        for (var i = 0; i < arrCookie.length; i++) {
                            var token = arrCookie[i].split("=");
                            if (!FPHDSdk.dataIsNull(token[1]) && token[0] == 'token') {
                                return token[1];
                            }
                        }

                        var params = FPHDSdk.getAllParam();
                        if (!FPHDSdk.dataIsNull(params.token)) {
                            return params.token;
                        }
                    }

                    return "";
                },

                _getSecretKey: function _getSecretKey() {
                    var params = FPHDSdk.getAllParam();
                    if (!FPHDSdk.dataIsNull(params.secretKey)) {
                        return params.secretKey;
                    }
                    return "";
                },

                _initApi: function _initApi(channelId) {
                    var host = location.host.split("-");
                    if (!FPHDSdk.dataIsNull(domainConfig[channelId])) {
                        //apiServerUrl = location.protocol + '//' + domainConfig[channelId];
                        apiServerUrl = JONO_HOST;
                        return;
                    }
                    if (host.length > 1) {
                        if (host[0] == 'alpha' || host[0] == 'beta') {
                            apiServerUrl = location.protocol + '//' + host[0] + '-uc.fpwan.com';
                        } else {
                            apiServerUrl = location.protocol + '//' + 'uc.fpwan.com';
                        }

                    } else {
                        if (host[0].indexOf('localhost') != -1) {
                            apiServerUrl = location.protocol + '//' + 'alpha-uc.fpwan.com';
                        } else {
                            apiServerUrl = location.protocol + '//' + 'uc.fpwan.com';
                        }
                    }
                    apiServerUrl = JONO_HOST;
                },

                _secretKeyLogin: function _secretKeyLogin(secretKey) {
                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };
                    var postUrl = apiServerUrl + "/user/login/secretKeyLogin?channelId=" + channelId + "&secretKey=" + secretKey;

                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code !== 0) {
                                callback(dataObj);
                            } else {
                                var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                                FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                returnData["code"] = 0;
                                returnData["msg"] = "success";
                                returnData["token"] = dataObj.data.token;
                                returnData["userId"] = dataObj.data.userId;
                                returnData["isStopService"] = dataObj.data.isStopService;
                                returnData["channelId"] = dataObj.data.channelId;

                                platFormUserInfo = returnData;

                                callback(returnData);
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _oldTokenLogin: function _oldTokenLogin(token) {

                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };
                    var browserType = FPHDSdk.getBrowserType();
                    var postUrl = apiServerUrl + "/user/login/oldTokenLogin?channelId=" + channelId + "&token=" + token + "&browserType=" + browserType;
                    // 检测用户登录的session是否过期
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code !== 0) {
                                // 封号
                                if (dataObj.code == 1084) {
                                    location.href = stopDomain;
                                }
                                callback(dataObj);
                            } else {
                                var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                                FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                returnData["code"] = 0;
                                returnData["msg"] = "success";
                                returnData["token"] = dataObj.data.token;
                                returnData["userId"] = dataObj.data.userId;
                                returnData["nickname"] = dataObj.data.nickname;
                                returnData["isStopService"] = dataObj.data.isStopService;
                                returnData["channelId"] = dataObj.data.channelId;

                                platFormUserInfo = returnData;

                                callback(returnData);
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _debugTokenLogin: function _debugTokenLogin() {

                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };

                    var params = FPHDSdk.getAllParam();
                    if (params['debug'] != 1 || FPHDSdk.dataIsNull(params['token']) || FPHDSdk.dataIsNull(params['sign']) || FPHDSdk.dataIsNull(params['time'])) {
                        callback(returnData);
                        return;
                    }
                    var browserType = FPHDSdk.getBrowserType();
                    var systemType = FPHDSdk.getSystemType();
                    var postUrl = apiServerUrl + "/user/login/tokenLogin?channelId=" + channelId + "&sign=" + params['sign'] + "&time=" + params['time'] + "&token=" + params['token'] + "&loginType=" + loginType + "&systemType=" + systemType + '&browserType=' + browserType;

                    if (isAdmin) {
                        postUrl += "&isAdmin=1";
                    }
                    // 检测用户登录的session是否过期
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code !== 0) {
                                // 封号
                                if (dataObj.code == 1084) {
                                    location.href = stopDomain;
                                }
                                callback(dataObj);
                            } else {
                                var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                                FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                returnData["code"] = 0;
                                returnData["msg"] = "success";
                                returnData["token"] = dataObj.data.token;
                                returnData["userId"] = dataObj.data.userId;
                                returnData["isStopService"] = dataObj.data.isStopService;
                                returnData["nickname"] = dataObj.data.nickname;
                                returnData["avatar"] = dataObj.data.avatar;
                                returnData["roleName"] = dataObj.data.roleName;
                                returnData["channelId"] = dataObj.data.channelId;
                                callback(returnData);

                                platFormUserInfo = returnData;

                                FPHDTaskSdk.getTaskList();
                                FPHDSdk._setPlatformInfoToApp(dataObj.data);
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _tokenLogin: function _tokenLogin() {

                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };
                    var FPHDSdkUserInfo = FPHDSdk.getCookie(FPHDSdkUserInfoKey);
                    FPHDSdkUserInfo = decodeURIComponent(FPHDSdkUserInfo);
                    var FPHDSdkUserInfos = FPHDSdkUserInfo.split("||");

                    var browserType = FPHDSdk.getBrowserType();
                    var systemType = FPHDSdk.getSystemType();
                    var postUrl = apiServerUrl + "/user/login/tokenLogin?channelId=" + channelId + "&sign=" + FPHDSdkUserInfos[0] + "&time=" + FPHDSdkUserInfos[1] + "&token=" + FPHDSdkUserInfos[3] + "&loginType=" + loginType + "&systemType=" + systemType + "&browserType=" + browserType;

                    if (isAdmin) {
                        postUrl += "&isAdmin=1";
                    }
                    // 检测用户登录的session是否过期
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code !== 0) {
                                // 封号
                                if (dataObj.code == 1084) {
                                    location.href = stopDomain;
                                }
                                callback(dataObj);
                            } else {
                                var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                                FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                returnData["code"] = 0;
                                returnData["msg"] = "success";
                                returnData["token"] = dataObj.data.token;
                                returnData["userId"] = dataObj.data.userId;
                                returnData["isStopService"] = dataObj.data.isStopService;
                                returnData["nickname"] = dataObj.data.nickname;
                                returnData["avatar"] = dataObj.data.avatar;
                                returnData["roleName"] = dataObj.data.roleName;
                                returnData["channelId"] = dataObj.data.channelId;
                                callback(returnData);

                                platFormUserInfo = returnData;

                                FPHDTaskSdk.getTaskList();
                                FPHDSdk._setPlatformInfoToApp(dataObj.data);
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _wechatLogin: function _wechatLogin() {

                    console.log("_wechatLogin")

                    // 判断是否是拿到微信返回code，服务器端可以通过code去拿到微信 access_token，进一步去拿用户信息
                    var params = FPHDSdk.getAllParam();
                    var code = params['code'];

                    // 跳转微信授权
                    if (FPHDSdk.dataIsNull(code)) {
                        FPHDSdk._getwechatAuthUrl();
                    } else {
                        console.log(">>>>>>_getUserInfoByWechatCode")
                        FPHDSdk._getUserInfoByWechatCode();
                    }

                    return;
                },

                _getwechatAuthUrl: function _getwechatAuthUrl() {

                    console.log("微信登陆2")
                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };

                    var postUrl = apiServerUrl + "/user/login/wechatLogin?action=getAuthUrl&channelId=" + channelId + "&loginType=" + loginType + "&isPayLogin=" + isPayLogin;
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象


                            console.log(dataObj)

                            if (dataObj.code !== 0) {
                                callback(dataObj);
                            } else {
                                var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId;
                                FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                var nowUrl = '';
                                var allParams = FPHDSdk.getAllParam();
                                if (allParams['code']) {
                                    var domainUrl = location.href;
                                    var arrUrl = domainUrl.split("//");
                                    var arrDomain = arrUrl[1].split("/");
                                    var start = arrUrl[1].indexOf("/");
                                    var relUrl = arrUrl[1].substring(start);
                                    if (relUrl.indexOf("?") != -1) {
                                        relUrl = relUrl.split("?")[0];
                                    }

                                    var strParams = '';
                                    for (var key in allParams) {

                                        if (key == 'code') {
                                            continue;
                                        }

                                        if (!strParams) {
                                            strParams = key + '=' + allParams[key];
                                        } else {
                                            strParams = strParams + '&' + key + '=' + allParams[key];
                                        }
                                    }

                                    nowUrl = arrUrl[0] + '//' + arrDomain[0] + relUrl;
                                    if (strParams) {
                                        nowUrl += '?' + strParams;
                                    }
                                } else {
                                    nowUrl = location.href;
                                }

                                // console.log(dataObj)
                                // var redirectUri = encodeURIComponent(apiServerUrl + '/user/login/oauth?redirectUri=' + encodeURIComponent(nowUrl) + '&channelId=' + channelId);
                               
                                // console.log(nowUrl)
                                var redirectUri = encodeURIComponent(nowUrl);

                                // var authUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + dataObj.data.appId + "&redirect_uri=" + redirectUri + "&response_type=code&scope=" + dataObj.data.scope + "&state=" + dataObj.data.state + "&connect_redirect=1#wechat_redirect";

                                // location.href = authUrl;

                                window.location.href = dataObj.data.url + dataObj.data.appId + '&redirect_uri=' + redirectUri + '&response_type=code&scope=snsapi_userinfo#wechat_redirect';



                                return;
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _getUserInfoByWechatCode: function _getUserInfoByWechatCode() {

                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };
                    var FPHDSdkUserInfo = FPHDSdk.getCookie(FPHDSdkUserInfoKey);
                    FPHDSdkUserInfo = decodeURIComponent(FPHDSdkUserInfo);
                    var FPHDSdkUserInfos = FPHDSdkUserInfo.split("||");

                    var params = FPHDSdk.getAllParam();
                    var code = params['code'];
                    console.log("微信登陆1")
                    var systemType = FPHDSdk.getSystemType();
                    var postUrl = apiServerUrl + "/user/login/wechatLogin?action=getUserInfo&channelId=" + channelId + "&code=" + code + "&systemType=" + systemType;
                    postUrl = postUrl + '&loginType=' + loginType + "&sign=" + FPHDSdkUserInfos[0] + "&time=" + FPHDSdkUserInfos[1];

                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code !== 0) {

                                if (dataObj.code == 1084) {
                                    location.href = stopDomain;
                                } else {
                                    FPHDSdk._getwechatAuthUrl();
                                }
                            } else {
                                var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                                FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                returnData["code"] = 0;
                                returnData["msg"] = "success";
                                returnData["token"] = dataObj.data.token;
                                returnData["userId"] = dataObj.data.userId;
                                returnData["nickname"] = dataObj.data.nickname;
                                returnData["avatar"] = dataObj.data.avatar;
                                returnData["roleName"] = dataObj.data.roleName;
                                returnData["isStopService"] = dataObj.data.isStopService;
                                returnData["channelId"] = dataObj.data.channelId;
                                callback(returnData);

                                platFormUserInfo = returnData;

                                FPHDTaskSdk.getTaskList();
                                FPHDSdk._setPlatformInfoToApp(dataObj.data);
                                return;
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _appWechatLogin: function _appWechatLogin(code) {

                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };

                    var systemType = FPHDSdk.getSystemType();

                    // app微信授权登录
                    if (!FPHDSdk.dataIsNull(code)) {
                        var postUrl = apiServerUrl + "/user/login/wechatLogin?action=getUserInfo&channelId=" + channelId + "&code=" + code + "&systemType=" + systemType;

                        // 读取浏览器类型，判断是否是在浏览器内打开
                        var browserType = FPHDSdk.getBrowserType();
                        if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                            postUrl = postUrl + '&loginType=fphdApp';
                        }

                        FPHDSdk.doGet({
                            url: postUrl,
                            onSuccess: function (data) {
                                var dataObj = eval("(" + data.response + ")");//转换为json对象
                                if (dataObj.code !== 0) {

                                    callback(dataObj);
                                } else {
                                    var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                                    FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                    returnData["code"] = 0;
                                    returnData["msg"] = "success";
                                    returnData["token"] = dataObj.data.token;
                                    returnData["userId"] = dataObj.data.userId;
                                    returnData["nickname"] = dataObj.data.nickname;
                                    returnData["avatar"] = dataObj.data.avatar;
                                    returnData["roleName"] = dataObj.data.roleName;
                                    returnData["isStopService"] = dataObj.data.isStopService;
                                    returnData["channelId"] = dataObj.data.channelId;
                                    callback(returnData);

                                    platFormUserInfo = returnData;

                                    FPHDTaskSdk.getTaskList();
                                    FPHDSdk._setPlatformInfoToApp(dataObj.data);
                                    FPHDSdk._deleteBaseElement();
                                    return;
                                }
                            },
                            onFail: function () {
                                returnData["code"] = 1002;
                                returnData["msg"] = "请求服务器失败";
                                callback(returnData);
                            }
                        });
                    }

                    return;
                },

                _qrCodeLogin: function _qrCodeLogin() {

                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };

                    var postUrl = apiServerUrl + "/user/login/qrCodeLogin?action=getQrCode&channelId=" + channelId;

                    // 检测用户登录的session是否过期
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code !== 0) {
                                if (dataObj.code == 1084) {
                                    location.href = stopDomain;
                                }
                                callback(dataObj);
                            } else {
                                var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId;
                                FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);
                                qrCodeSessionId = dataObj.data.sessionId;

                                _qrCodeLoginTimer = 0;
                                setTimeout(FPHDSdk._checkQrCodeLogin, 2000);

                                // 创建二维码
                                var iframeUrl = apiServerUrl + "/weChat/getQrCode?channelId=" + channelId + "&sign=" + dataObj.data.sign + "&time=" + dataObj.data.time + "&qrCodeUrl=" + dataObj.data.qrCodeUrl;

                                var html = '<iframe scrolling="auto" src="' + iframeUrl + '" style="border: 0px; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;z-index: 1000;" name="qrCodeDivIframe" id="qrCodeDivIframe"></iframe>';

                                FPHDSdk._createBaseElement(html);
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _appLogin: function _appLogin() {

                    var params = FPHDSdk.getAllParam();
                    var from = params['from'];

                    // 跳转微信授权
                    if (FPHDSdk.dataIsNull(from) || from != 'fphdApp') {
                        // 创建二维码
                        var timestamp = new Date().getTime();
                        var iframeUrl = "https://locallife.fpwan.com/app/appLogin.html?v=" + timestamp;

                        var html = '<iframe scrolling="auto" src="' + iframeUrl + '" style="border: 0px; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;z-index: 1000;" name="appLoginDivIframe" id="appLoginDivIframe"></iframe>';

                        FPHDSdk._createBaseElement(html);

                        // 创建底部上滑弹窗
                        FPHDSdk._createBottomSheet();
                    } else {

                        var browserType = FPHDSdk.getBrowserType();
                        if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                            var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                            if (fpapp) {
                                fpapp.postMessage(JSON.stringify({ action: "OnLoginData" }));
                            } else if (window.OnLoginData) {
                                OnLoginData.postMessage("");
                            }
                        }
                    }

                    return;
                },

                _appNewLogin: function _appNewLogin() {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "OnLoginData" }));
                        } else if (window.OnLoginData) {
                            OnLoginData.postMessage("");
                        }
                    }

                    // 创建底部上滑弹窗
                    FPHDSdk._createBottomSheet();

                    return;
                },

                _checkQrCodeLogin: function _checkQrCodeLogin() {

                    var returnData = { code: 1001, msg: "登录超时，请刷新重新扫码！" };
                    var callback = loginCallbackFun;

                    if (_qrCodeLoginTimer > 180) {
                        FPHDSdk.showTips('登录超时，请刷新重新扫码！');
                        callback(returnData);
                        return;
                    }
                    _qrCodeLoginTimer += 1;
                    var FPHDSdkUserInfo = FPHDSdk.getCookie(FPHDSdkUserInfoKey);
                    FPHDSdkUserInfo = decodeURIComponent(FPHDSdkUserInfo);
                    var FPHDSdkUserInfos = FPHDSdkUserInfo.split("||");

                    var postUrl = apiServerUrl + "/user/login/qrCodeLogin?action=getLoginStatus&channelId=" + channelId + "&sign=" + FPHDSdkUserInfos[0] + "&time=" + FPHDSdkUserInfos[1] + "&loginType=" + loginType + "&sessionId=" + qrCodeSessionId;
                    if (isAdmin) {
                        postUrl += "&isAdmin=1";
                    }
                    // 检测用户登录的session是否过期
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code !== 0) {
                                if (dataObj.code == 1084) {
                                    location.href = stopDomain;
                                }
                                callback(dataObj);
                            } else {

                                if (dataObj.data.status == 1) {
                                    var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                                    FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                    // 成功登录移除二维码
                                    FPHDSdk._deleteBaseElement();

                                    returnData["code"] = 0;
                                    returnData["msg"] = "success";
                                    returnData["token"] = dataObj.data.token;
                                    returnData["userId"] = dataObj.data.userId;
                                    returnData["nickname"] = dataObj.data.nickname;
                                    returnData["avatar"] = dataObj.data.avatar;
                                    returnData["roleName"] = dataObj.data.roleName;
                                    returnData["isStopService"] = dataObj.data.isStopService;
                                    returnData["channelId"] = dataObj.data.channelId;
                                    callback(returnData);

                                    platFormUserInfo = returnData;

                                    FPHDSdk._setPlatformInfoToApp(dataObj.data);

                                } else {
                                    setTimeout(FPHDSdk._checkQrCodeLogin, 2000);
                                }

                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _miniprogramLogin: function _miniprogramLogin() {

                    var returnData = { code: 1001, msg: "非法登录！" };
                    var callback = loginCallbackFun;
                    var params = FPHDSdk.getAllParam();
                    if (FPHDSdk.dataIsNull(params['sign']) || FPHDSdk.dataIsNull(params['time']) || FPHDSdk.dataIsNull(params['sessionId'])) {
                        FPHDSdk.showTips('非法登录！');
                        callback(returnData);
                        return;
                    }

                    var postUrl = apiServerUrl + "/user/login/miniprogramLogin?action=getUserInfo&channelId=" + channelId + "&sign=" + params['sign'] + "&time=" + params['time'] + "&loginType=" + loginType + "&sessionId=" + params['sessionId'];
                    // 检测用户登录的session是否过期
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code !== 0) {
                                if (dataObj.code == 1084) {
                                    location.href = stopDomain;
                                }
                                callback(dataObj);
                            } else {

                                var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                                FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                                // 成功登录移除二维码
                                FPHDSdk._deleteBaseElement();

                                returnData["code"] = 0;
                                returnData["msg"] = "success";
                                returnData["token"] = dataObj.data.token;
                                returnData["userId"] = dataObj.data.userId;
                                returnData["nickname"] = dataObj.data.nickname;
                                returnData["avatar"] = dataObj.data.avatar;
                                returnData["roleName"] = dataObj.data.roleName;
                                returnData["isStopService"] = dataObj.data.isStopService;
                                returnData["channelId"] = dataObj.data.channelId;
                                callback(returnData);

                                platFormUserInfo = returnData;

                                FPHDTaskSdk.getTaskList();
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    return;
                },

                _createBaseElement: function _createBaseElement(html) {

                    var documentObj = document.getElementById(baseElementId);
                    if (!FPHDSdk.dataIsNull(documentObj)) {
                        documentObj.innerHTML = '';
                    } else {
                        var fphdIframeDiv = document.createElement("fphddiv");
                        fphdIframeDiv.id = baseElementId;
                        fphdIframeDiv.style.width = "100%";
                        fphdIframeDiv.style.height = "100%";
                        fphdIframeDiv.style.top = "0";
                        fphdIframeDiv.style.left = "0";
                        fphdIframeDiv.style.position = "fixed";
                        fphdIframeDiv.style.zIndex = "999";
                        fphdIframeDiv.style.display = 'block';
                        fphdIframeDiv.style.background = '#999';
                        document.body.appendChild(fphdIframeDiv);
                    }
                    var systemType = FPHDSdk.getSystemType();
                    // 创建iframe，ios触摸需要特殊解决
                    var baseHtml = '';
                    if (systemType === "ios") {
                        baseHtml = baseHtml + '<fphddiv style="-webkit-overflow-scrolling:touch;overflow-y: scroll; width:100%; height:100%;">' + html + '</fphddiv>';
                    } else {
                        baseHtml = html;
                    }
                    document.getElementById(baseElementId).innerHTML = baseHtml;

                    return;
                },

                _deleteBaseElement: function _deleteBaseElement() {

                    var documentObj = document.getElementById(baseElementId);
                    if (!FPHDSdk.dataIsNull(documentObj)) {
                        document.body.removeChild(documentObj);
                    }
                    return;
                },

                _iframeEventListener: function _iframeEventListener(event) {

                    if (!event.data) {
                        return;
                    }

                    if (typeof event.data === "string") {
                        if (event.data.indexOf('{') != -1 && event.data.indexOf('}') != -1) {
                            var responseData = JSON.parse(event.data);
                        }

                    } else {
                        var responseData = event.data;
                    }

                    if (!responseData) {
                        return;
                    }

                    // 判断是否是移除iframe弹窗
                    if (responseData.action == 'remove') {
                        FPHDSdk._deleteBaseElement();
                    }

                    if (!FPHDSdk.dataIsNull(responseData.token)) {
                        var callback = loginCallbackFun;

                        var fphdSdkUserInfo = responseData.sign + "||" + responseData.time + "||" + responseData.channelId + "||" + responseData.token;
                        FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                        var returnData = {};
                        returnData["code"] = 0;
                        returnData["msg"] = "success";
                        returnData["channelId"] = responseData.channelId;
                        returnData["token"] = responseData.token;
                        returnData["userId"] = responseData.userId;
                        returnData["nickname"] = responseData.nickname;
                        returnData["avatar"] = responseData.avatar;
                        returnData["roleName"] = responseData.roleName;
                        returnData["isStopService"] = responseData.isStopService;
                        callback(returnData);

                        platFormUserInfo = returnData;

                        FPHDTaskSdk.getTaskList();
                        FPHDSdk._setPlatformInfoToApp(responseData);
                    }

                    if (!FPHDSdk.dataIsNull(responseData.redirectUrl)) {
                        location.href = responseData.redirectUrl;
                    }

                    // 本地玩APP登录
                    if (responseData.action == 'appLogin') {
                        if (responseData.loginType == 'weChat') {
                            var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                            if (fpapp) {
                                fpapp.postMessage(JSON.stringify({ action: "AppLogin" }));
                            } else if (window.AppLogin) {
                                AppLogin.postMessage("");
                            }
                        }

                        if (responseData.loginType == 'phone') {

                            FPHDSdk._deleteBaseElement();
                            FPHDSdk._phoneLogin('appLogin');
                        }

                    }

                    return;
                },

                _selectLogin: function _selectLogin() {

                    var html = '<link rel="stylesheet"  href="' + apiServerUrl + '/misc/css/bootstrap.min.css">';
                    html = html + '<button type="button" class="btn btn-default"   onclick="FPHDSdk._qrCodeLogin()">微信扫码登录</button><button class="btn btn-success"  type="button"  onclick="FPHDSdk._phoneLogin()">手机号登录</button>';
                    FPHDSdk._createBaseElement(html);
                },

                _phoneLogin: function _phoneLogin(from) {

                    if (!from) {
                        from = 'platform';
                    }

                    // 创建iframe页面
                    var iframeUrl = apiServerUrl + "/user/login/phoneLogin.html?channelId=" + channelId + "&from=" + from;
                    var html = '<iframe scrolling="auto" src="' + iframeUrl + '" style="border: 0px; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;z-index: 1000;" name="phoneLoginDivIframe" id="phoneLoginDivIframe"></iframe>';

                    FPHDSdk._createBaseElement(html);
                    return;
                },

                _createBottomSheet: function _createBottomSheet(isTestUser) {

                    if (isTestUser) {

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "MarkTestUser", data: "testUser" }));
                        } else if (window.MarkTestUser) {
                            MarkTestUser.postMessage("testUser");
                        }

                    }

                    if (isUseWebBottomSheet == false) {
                        return;
                    }

                    var documentObj = document.getElementById("FPHDSdkBottomSheet");
                    if (!FPHDSdk.dataIsNull(documentObj)) {
                        documentObj.innerHTML = '';
                    } else {
                        var fphdDiv = document.createElement("fphddiv");
                        fphdDiv.id = "FPHDSdkBottomSheet";
                        fphdDiv.style.position = "fixed";
                        fphdDiv.style.zIndex = "9000";
                        fphdDiv.style.display = 'none';
                        fphdDiv.style.fontSize = '16px';
                        fphdDiv.style.textAlign = 'center';
                        document.body.appendChild(fphdDiv);
                    }

                    var html = '<div id="FPHDSdkBottomSheetModel" onclick="FPHDSdk._closeBottomSheetModel();" style="position: fixed;top: 0;bottom: 0;left: 0;right: 0;background: rgba(0,0,0,.5);transition: .2s linear;display: none;"></div>\n' +
                        '    <ul id="FPHDSdkBottomSheetToolBox"\n' +
                        '        style="list-style: none;\n' +
                        '        padding: 0;\n' +
                        '        margin: 0;\n' +
                        '        position: fixed;\n' +
                        '        right: 0;\n' +
                        '        left: 0;\n' +
                        '        bottom: -22em;;\n' +
                        '        background: white;\n' +
                        '        border-radius: 1.5em 1.5em 0 0;\n' +
                        '        transition: .2s linear;">\n' +
                        '        <li>\n' +
                        '            <p style="color: #696969;font-size: .8em;margin: 1.5em 0 .5em 0;">分享与便捷工具</p>\n' +
                        '        </li>\n' +
                        '        <li>\n' +
                        '            <ul style="list-style: none; display: flex;\n' +
                        '        justify-content: flex-start;\n' +
                        '        flex-wrap: wrap;\n' +
                        '        padding: 0 5%;">\n' +
                        '                <li style="margin: 3%;width: 19%;height: auto;" onclick="FPHDSdk._onBottomSheetMenu(\'ShareWechatFriend\');">\n' +
                        '                    <div style="position: relative;width: 100%;height: auto;border-radius: 50%;">\n' +
                        '                        <img style="width: 100%;height: 100%;" src="/attachment/article/191230112454_5e096e064b4f1.png" alt="">\n' +
                        '                    </div>\n' +
                        '                    <span style="display: inline-block;margin-top: .9em;font-size: .8em;color:  #696969;">微信好友</span>\n' +
                        '                </li>\n' +
                        '                <li style="margin: 3%;width: 19%;height: auto;" onclick="FPHDSdk._onBottomSheetMenu(\'ShareWechatTimeLine\');">\n' +
                        '                    <div style="position: relative;width: 100%;height: auto;border-radius: 50%;">\n' +
                        '                        <img style="width: 100%;height: 100%;" src="/attachment/article/191230112437_5e096df54b267.png" alt="">\n' +
                        '                    </div>\n' +
                        '                    <span style="display: inline-block;margin-top: .9em;font-size: .8em;color:  #696969;">朋友圈</span>\n' +
                        '                </li>\n' +
                        '                <li style="margin: 3%;width: 19%;height: auto;" onclick="FPHDSdk._onBottomSheetMenu(\'CopyUrl\');">\n' +
                        '                    <div style="position: relative;width: 100%;height: auto;border-radius: 50%;">\n' +
                        '                        <img style="width: 100%;height: 100%;" src="/attachment/article/191230112415_5e096ddf6563d.png" alt="">\n' +
                        '                    </div>\n' +
                        '                    <span style="display: inline-block;margin-top: .9em;font-size: .8em;color:  #696969;">复制链接</span>\n' +
                        '                </li>\n' +
                        '                <li style="margin: 3%;width: 19%;height: auto;" onclick="FPHDSdk._onBottomSheetMenu(\'ClearCache\');">\n' +
                        '                    <div style="position: relative;width: 100%;height: auto;border-radius: 50%;">\n' +
                        '                        <img style="width: 100%;height: 100%;" src=".png" alt="">\n' +
                        '                    </div>\n' +
                        '                    <span style="display: inline-block;margin-top: .9em;font-size: .8em;color:  #696969;">清理缓存</span>\n' +
                        '                </li>\n' +
                        '                <li style="margin: 3%;width: 19%;height: auto;" onclick="FPHDSdk._onBottomSheetMenu(\'Refush\');">\n' +
                        '                    <div style="position: relative;width: 100%;height: auto;border-radius: 50%;">\n' +
                        '                        <img style="width: 100%;height: 100%;" src="/attachment/article/191230112524_5e096e2445e59.png" alt="">\n' +
                        '                    </div>\n' +
                        '                    <span style="display: inline-block;margin-top: .9em;font-size: .8em;color:  #696969;">刷新页面</span>\n' +
                        '                </li>\n' +
                        '                <li style="margin: 3%;width: 19%;height: auto;" onclick="FPHDSdk._onBottomSheetMenu(\'ScanQR\');">\n' +
                        '                    <div style="position: relative;width: 100%;height: auto;border-radius: 50%;">\n' +
                        '                        <img style="width: 100%;height: 100%;" src="/attachment/article/191230112550_5e096e3e45b66.png" alt="">\n' +
                        '                    </div>\n' +
                        '                    <span style="display: inline-block;margin-top: .9em;font-size: .8em;color:  #696969;">扫一扫</span>\n' +
                        '                </li>';

                    if (isTestUser) {
                        html += '                <li style="margin: 3%;width: 19%;height: auto;" onclick="FPHDSdk._onBottomSheetMenu(\'alpha\');">\n' +
                            '                    <div style="position: relative;width: 100%;height: auto;border-radius: 50%;">\n' +
                            '                        <img style="width: 100%;height: 100%;" src="/attachment/article/191230112415_5e096ddf6563d.png" alt="">\n' +
                            '                    </div>\n' +
                            '                    <span style="display: inline-block;margin-top: .9em;font-size: .8em;color:  #696969;">alpha</span>\n' +
                            '                </li>\n' +
                            '                <li style="margin: 3%;width: 19%;height: auto;" onclick="FPHDSdk._onBottomSheetMenu(\'beta\');">\n' +
                            '                    <div style="position: relative;width: 100%;height: auto;border-radius: 50%;">\n' +
                            '                        <img style="width: 100%;height: 100%;" src=".png" alt="">\n' +
                            '                    </div>\n' +
                            '                    <span style="display: inline-block;margin-top: .9em;font-size: .8em;color:  #696969;">beta</span>\n' +
                            '                </li>\n';
                    }

                    html += '            </ul>\n' +
                        '        </li>\n' +
                        '        <li onclick="FPHDSdk._closeBottomSheetModel();" style="height: 3em;line-height: 3em;border-top: 2px solid #ECECEC;font-size: 1.2em;color: #696969;">取消</li>\n' +
                        '    </ul>';

                    document.getElementById("FPHDSdkBottomSheet").innerHTML = html;
                },

                _openBottomSheetModel: function _openBottomSheetModel() {
                    document.getElementById("FPHDSdkBottomSheet").style.display = "block";
                    document.getElementById("FPHDSdkBottomSheetModel").style.display = "block";
                    document.getElementById("FPHDSdkBottomSheetToolBox").style.bottom = "0";
                },

                _closeBottomSheetModel: function _closeBottomSheetModel() {
                    document.getElementById("FPHDSdkBottomSheetModel").style.display = "none";
                    document.getElementById("FPHDSdkBottomSheetToolBox").style.bottom = "-22rem";

                    FPHDSdk.callApp('TopMenuCancel', '');
                },

                /**
                 * 显示tips信息
                 * @param msg
                 */
                showTips: function showAppTips(msg) {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "Toast", data: msg }));
                        } else if (window.Toast) {
                            Toast.postMessage(msg);
                        }
                    } else {
                        alert(msg);
                    }
                },

                /**
                 * 向 APP 传用户信息
                 */
                _setPlatformInfoToApp: function _setPlatformInfoToApp(info) {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        var returnData = {};
                        returnData["code"] = 0;
                        returnData["msg"] = "success";
                        returnData["channelId"] = info.channelId;
                        returnData["token"] = info.token;
                        returnData["userId"] = info.userId;
                        returnData["nickname"] = info.nickname;
                        returnData["avatar"] = info.avatar;
                        returnData["roleName"] = info.roleName;
                        returnData["isStopService"] = info.isStopService;

                        platFormUserInfo = returnData;

                        // 创建底部上滑弹窗
                        FPHDSdk._createBottomSheet(info.isTestUser);

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "PlatformInfo", data: returnData }));
                        } else if (window.PlatformInfo) {
                            PlatformInfo.postMessage(JSON.stringify(returnData));
                        }
                    }
                },

                /**
                 * 调用app
                 */
                callApp: function callApp(action, data) {

                    if (!action) {
                        return false;
                    }

                    var message = { action: action, data: data };

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify(message));
                        } else if (window.CallApp) {
                            CallApp.postMessage(JSON.stringify(message));
                        }
                    }
                },

                /**
                 * APP 回调信息
                 */
                onAppCallback: function onAppCallback(data) {

                    console.log('onAppCallback');
                    console.log(data);

                    if (!data) {
                        return;
                    }

                    var dataObj = eval("(" + data + ")");//转换为json对象
                    if (FPHDSdk.dataIsNull(dataObj) || FPHDSdk.dataIsNull(dataObj.action)) {
                        return;
                    }

                    console.log('onAppCallback listenerList');
                    console.log(JSON.stringify(listenerList));
                    console.log(listenerList[dataObj.action]);

                    var callback = listenerList[dataObj.action];
                    if (callback) {
                        callback(dataObj.data);
                    }
                },

                /**
                 * APP 返回原生登录的信息
                 */
                onLoginData: function onLoginData(data) {

                    if (!data) {
                        // 创建二维码
                        var timestamp = new Date().getTime();
                        var iframeUrl = "https://locallife.fpwan.com/app/appLogin.html?v=" + timestamp;

                        var html = '<iframe scrolling="auto" src="' + iframeUrl + '" style="border: 0px; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;z-index: 1000;" name="appLoginDivIframe" id="appLoginDivIframe"></iframe>';

                        FPHDSdk._createBaseElement(html);

                        // 创建底部上滑弹窗
                        FPHDSdk._createBottomSheet();
                        return;
                    }

                    var callback = loginCallbackFun;
                    var returnData = { code: 1001, msg: "缺少参数 channelId" };

                    var dataObj = eval("(" + data + ")");//转换为json对象
                    if (dataObj.code !== 0) {

                        callback(dataObj);
                    } else {
                        var fphdSdkUserInfo = dataObj.data.sign + "||" + dataObj.data.time + "||" + dataObj.data.channelId + "||" + dataObj.data.token;
                        FPHDSdk.addCookie(FPHDSdkUserInfoKey, fphdSdkUserInfo, 86400 * 30);

                        returnData["code"] = 0;
                        returnData["msg"] = "success";
                        returnData["token"] = dataObj.data.token;
                        returnData["userId"] = dataObj.data.userId;
                        returnData["nickname"] = dataObj.data.nickname;
                        returnData["avatar"] = dataObj.data.avatar;
                        returnData["roleName"] = dataObj.data.roleName;
                        returnData["isStopService"] = dataObj.data.isStopService;
                        returnData["channelId"] = dataObj.data.channelId;
                        callback(returnData);

                        platFormUserInfo = returnData;

                        FPHDTaskSdk.getTaskList();
                        FPHDSdk._setPlatformInfoToApp(dataObj.data);
                        return;
                    }

                },

                /**
                 * APP 异步回传微信登录code，提供给APP调用
                 */
                onWeChatCode: function onWeChatCode(code) {
                    FPHDSdk._appWechatLogin(code);
                },

                /**
                 * APP 异步回传返回按钮监控，提供给APP调用
                 */
                onNavBack: function onNavBack() {

                    var callback = listenerList['goback'];
                    if (callback) {
                        callback();
                    } else {

                        var browserType = FPHDSdk.getBrowserType();
                        if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                            var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                            if (fpapp) {
                                fpapp.postMessage(JSON.stringify({ action: "OnNavBack" }));
                            } else if (window.OnNavBack) {
                                OnNavBack.postMessage("");
                            }
                        }
                    }
                },

                /**
                 * APP 异步回传剪切板内容，提供给APP调用
                 * @param data
                 */
                onClipboardData: function onClipboardData(data) {

                    var callback = listenerList['clipboard'];
                    if (callback) {
                        callback(data);
                    }
                },

                /**
                 * APP 扫码后异步回调，提供给APP调用
                 * @param data
                 */
                onScanQR: function onScanQR(data) {

                    if (data.indexOf('http') != -1 && data.indexOf('fpwan.com') != -1) {

                        var url = data;
                        var theRequest = new Object();
                        if (url.indexOf("?") != -1) {
                            var str = url.split("?")[1];
                            if (str.indexOf("&") != -1) {
                                var strs = str.split("&");
                                for (var i = 0; i < strs.length; i++) {
                                    var tmpStrs = strs[i].split("=");
                                    if (tmpStrs.length > 2) {

                                        var string = strs[i].split(tmpStrs[0] + "=");
                                        if (string[1].indexOf("#") != -1) {
                                            theRequest[tmpStrs[0]] = string[1].split("#")[0];
                                        } else {
                                            theRequest[tmpStrs[0]] = string[1];
                                        }
                                    } else {
                                        if (tmpStrs[1].indexOf("#") != -1) {
                                            theRequest[tmpStrs[0]] = tmpStrs[1].split("#")[0];
                                        } else {
                                            theRequest[tmpStrs[0]] = tmpStrs[1];
                                        }
                                    }
                                }
                            } else {
                                if (str.indexOf("=") != -1) {
                                    var tmpStrs = str.split("=");
                                    if (tmpStrs[1].indexOf("#") != -1) {
                                        theRequest[tmpStrs[0]] = tmpStrs[1].split("#")[0];
                                    } else {
                                        theRequest[tmpStrs[0]] = tmpStrs[1];
                                    }
                                }
                            }
                        }

                        var requestParam = 'isAppScanQR=1';
                        for (var key in theRequest) {
                            requestParam += '&' + key + '=' + theRequest[key];
                        }

                        var hrefUrl = url.split(".html?")[0] + ".html?" + requestParam;
                        if (url.split("#").length > 1) {
                            hrefUrl += '#' + url.split("#")[1];
                        }

                        window.location.href = hrefUrl;
                    } else {

                        var callback = listenerList['scanQR'];
                        if (callback) {
                            callback(data);
                        }
                    }
                },

                /**
                 * 点击 APP 右上角按钮，提供给本地玩APP调用
                 * @param data
                 */
                onRightTopMenu: function onRightTopMenu() {

                    if (isUseWebBottomSheet) {
                        // 调用web端上滑弹窗显示
                        FPHDSdk._openBottomSheetModel();
                    } else {

                        // 调用APP端上滑弹窗显示
                        var browserType = FPHDSdk.getBrowserType();
                        if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                            var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                            if (fpapp) {
                                fpapp.postMessage(JSON.stringify({ action: "OnRightTopMenu" }));
                            } else if (window.OnRightTopMenu) {
                                OnRightTopMenu.postMessage("");
                            }
                        }
                    }
                },

                /**
                 * APP 异步回传经纬度信息，提供给APP调用
                 * @param data
                 */
                onLocation: function onLocation(data) {

                    console.log("获取app定位信息:onLocation");
                    console.log(data);

                    var timestamp = parseInt(new Date().getTime() / 1000);
                    var callback = listenerList['amapLocation'];
                    if (callback) {

                        if (FPHDSdk.dataIsNull(data)) {
                            FPHDSdk._webGetLocation(callback);
                        } else {

                            var arrData = data.split(',');
                            if (parseInt(arrData[1]) == 0 || parseInt(arrData[0]) == 0) {
                                FPHDSdk._webGetLocation(callback);
                            } else {
                                var info = {};
                                info["latitude"] = arrData[1]; // 纬度，浮点数，范围为90 ~ -90
                                info["longitude"] = arrData[0]; // 经度，浮点数，范围为180 ~ -180。

                                amapLocationInfo.time = timestamp;
                                amapLocationInfo.latitude = arrData[1];
                                amapLocationInfo.longitude = arrData[0];

                                callback(info);
                            }
                        }

                    }
                },

                /**
                 * 点击按钮调用 APP 的接口
                 * @param data
                 */
                _onBottomSheetMenu: function _onBottomSheetMenu(menu) {

                    var value = "";
                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            switch (menu) {
                                case "ShareWechatFriend":
                                    fpapp.postMessage(JSON.stringify({ action: "ShareWechatFriend" }));
                                    break;
                                case "ShareWechatTimeLine":
                                    fpapp.postMessage(JSON.stringify({ action: "ShareWechatTimeLine" }));
                                    break;
                                case "CopyUrl":
                                    fpapp.postMessage(JSON.stringify({ action: "CopyUrl" }));
                                    break;
                                case "ClearCache":
                                    fpapp.postMessage(JSON.stringify({ action: "ClearCache" }));
                                    break;
                                case "Refush":
                                    fpapp.postMessage(JSON.stringify({ action: "Refush" }));
                                    break;
                                case "ScanQR":
                                    fpapp.postMessage(JSON.stringify({ action: "ScanQR" }));
                                    break;
                                case "alpha":
                                    fpapp.postMessage(JSON.stringify({ action: "SetVersion", version: "alpha" }));
                                    break;
                                case "beta":
                                    fpapp.postMessage(JSON.stringify({ action: "SetVersion", version: "beta" }));
                                    break;
                            }

                        } else {
                            switch (menu) {
                                case "ShareWechatFriend":
                                    if (window.ShareWechatFriend) {
                                        ShareWechatFriend.postMessage("");
                                    }
                                    break;
                                case "ShareWechatTimeLine":
                                    if (window.ShareWechatTimeLine) {
                                        ShareWechatTimeLine.postMessage("");
                                    }
                                    break;
                                case "CopyUrl":
                                    if (window.CopyUrl) {
                                        CopyUrl.postMessage("");

                                        FPHDSdk.showTips('复制成功');
                                    }
                                    break;
                                case "ClearCache":
                                    if (window.ClearCache) {
                                        ClearCache.postMessage("");

                                        FPHDSdk.showTips('已经清理完成');
                                    }
                                    break;
                                case "Refush":
                                    if (window.Refush) {
                                        Refush.postMessage("");
                                    }
                                    break;
                                case "ScanQR":
                                    if (window.ScanQR) {
                                        ScanQR.postMessage("");
                                    }
                                    break;
                                case "alpha":
                                    if (window.SetVersion) {
                                        SetVersion.postMessage("alpha");
                                    }
                                    break;
                                case "beta":
                                    if (window.SetVersion) {
                                        SetVersion.postMessage("beta");
                                    }
                                    break;
                            }
                        }

                        // 创建底部上滑弹窗
                        FPHDSdk._closeBottomSheetModel();
                    }
                },

                /**
                 * 设置app打开平台的版本
                 */
                setAppOpenVersion: function setAppOpenVersion(version) {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "SetVersion", version: version }));
                        } else if (window.SetVersion) {
                            SetVersion.postMessage(version);
                        }
                    }
                },

                /**
                 * 获取 APP 剪切板内容
                 */
                getClipboard: function getClipboard(callback) {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        FPHDSdk.addEventListener('clipboard', callback);

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "Clipboard" }));
                        } else if (window.Clipboard) {
                            Clipboard.postMessage("");
                        }
                    }
                },

                /**
                 * 调用app扫码
                 */
                scanQR: function scanQR(callback) {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        FPHDSdk.addEventListener('scanQR', callback);

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "ScanQR" }));
                        } else if (window.ScanQR) {
                            ScanQR.postMessage("");
                        }
                    }
                },

                /**
                 * 最小化 APP
                 */
                minimizeApp: function () {
                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "MinimizeApp" }));
                        } else if (window.MinimizeApp) {
                            MinimizeApp.postMessage("");
                        }
                    }
                },

                /**
                 * 退出登录
                 */
                logout: function logout() {

                    FPHDSdk.delCookie(FPHDSdkUserInfoKey);

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "Logout" }));
                        } else if (window.Logout) {
                            Logout.postMessage("");
                        }
                    } else {
                        var nowUrl = window.location.href;
                        var nowUrlArr = nowUrl.split('?');
                        if (notPhoneLoginChannelId.indexOf(channelId) == -1) {
                            var url = nowUrlArr[0] + "?channelId=" + channelId + "#/index/interface";
                        } else {
                            var url = nowUrlArr[0] + "?channelId=" + channelId;
                        }

                        window.location.href = url;
                    }

                },

                /**
                 * 刷新地址
                 */
                reloadUrl: function reloadUrl(url) {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {
                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "ReloadUrl", url: url }));
                        } else if (window.ReloadUrl) {
                            ReloadUrl.postMessage(url);
                        }
                    } else {
                        window.location.href = url;
                    }
                },

                /**
                 * 设置 APP 顶部标题
                 */
                setAppTitle: function setAppTitle(title) {

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "SetTitle", data: title }));
                        } else if (window.SetTitle) {
                            SetTitle.postMessage(title);
                        }
                    }

                },

                /**
                 * 设置分享信息
                 */
                setShareInfo: function setShareInfo(json) {

                    // 设置小程序转发接口
                    var systemType = FPHDSdk.getSystemType();
                    if (systemType == 'miniprogram') {

                        var url = json.link;
                        var theRequest = new Object();
                        if (url.indexOf("?") != -1) {
                            var str = url.split("?")[1];
                            if (str.indexOf("&") != -1) {
                                var strs = str.split("&");
                                for (var i = 0; i < strs.length; i++) {
                                    var tmpStrs = strs[i].split("=");
                                    if (tmpStrs.length > 2) {

                                        var string = strs[i].split(tmpStrs[0] + "=");
                                        if (string[1].indexOf("#") != -1) {
                                            theRequest[tmpStrs[0]] = string[1].split("#")[0];
                                        } else {
                                            theRequest[tmpStrs[0]] = string[1];
                                        }
                                    } else {
                                        if (tmpStrs[1].indexOf("#") != -1) {
                                            theRequest[tmpStrs[0]] = tmpStrs[1].split("#")[0];
                                        } else {
                                            theRequest[tmpStrs[0]] = tmpStrs[1];
                                        }
                                    }
                                }
                            } else {
                                if (str.indexOf("=") != -1) {
                                    var tmpStrs = str.split("=");
                                    if (tmpStrs[1].indexOf("#") != -1) {
                                        theRequest[tmpStrs[0]] = tmpStrs[1].split("#")[0];
                                    } else {
                                        theRequest[tmpStrs[0]] = tmpStrs[1];
                                    }
                                }
                            }
                        }

                        var requestParam = '';
                        for (var key in theRequest) {
                            if (key == 'token' || key == 'openid' || key == 'sessionId' || key == 'sign' || key == 'systemType') {
                                continue;
                            }

                            if (!requestParam) {
                                requestParam = key + '=' + theRequest[key];
                            } else {
                                requestParam += '&' + key + '=' + theRequest[key];
                            }
                        }

                        var shareUrl = url.split(".html?")[0] + ".html?" + requestParam;
                        if (url.split("#").length > 1) {
                            shareUrl += '#' + url.split("#")[1];
                        }

                        json.link = shareUrl;
                        wx.miniProgram.postMessage({ data: { data: json, action: "share" } });
                        return;
                    }

                    json.link = location.origin + '/hashShare.html?redirectUrl=' + encodeURIComponent(json.link);

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'weixin') {

                        weixinJsConfig.jsApiList = [
                            "updateTimelineShareData",
                            "updateAppMessageShareData",
                            "onMenuShareWeibo"
                        ];

                        wx.config(weixinJsConfig);
                        wx.ready(function () {
                            wx.updateAppMessageShareData({
                                title: json.title, // 分享标题
                                desc: json.desc, // 分享描述
                                link: json.link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                                imgUrl: json.imgUrl, // 分享图标
                                success: function () {
                                    // 用户确认分享后执行的回调函数
                                }
                            });
                            wx.updateTimelineShareData({
                                title: json.title, // 分享标题
                                link: json.link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                                imgUrl: json.imgUrl, // 分享图标
                                success: function () {
                                    // 用户确认分享后执行的回调函数
                                }
                            });
                            wx.onMenuShareWeibo({
                                title: json.title, // 分享标题
                                desc: json.desc, // 分享描述
                                link: json.link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                                imgUrl: json.imgUrl, // 分享图标
                                success: function () {
                                    // 用户确认分享后执行的回调函数
                                },
                                cancel: function () {
                                    // 用户取消分享后执行的回调函数
                                }
                            });
                            wx.error(function (res) {
                            });
                        });
                    } else if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        var shareInfo = {};
                        shareInfo.title = json.title || "";
                        shareInfo.desc = json.desc || "";
                        shareInfo.link = json.link || "";
                        shareInfo.icon = json.imgUrl || "";

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "ShareInfo", data: shareInfo }));
                        } else if (window.ShareInfo) {
                            ShareInfo.postMessage(JSON.stringify(shareInfo));
                        }
                    }

                    return;
                },

                /**
                 * 分享
                 */
                share: function share(json) {

                    json.link = location.origin + '/hashShare.html?redirectUrl=' + encodeURIComponent(json.link);

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'weixin') {

                        weixinJsConfig.jsApiList = [
                            "updateTimelineShareData",
                            "updateAppMessageShareData",
                            "onMenuShareWeibo"
                        ];

                        wx.config(weixinJsConfig);
                        wx.ready(function () {
                            wx.updateAppMessageShareData({
                                title: json.title, // 分享标题
                                desc: json.desc, // 分享描述
                                link: json.link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                                imgUrl: json.imgUrl, // 分享图标
                                success: function () {
                                    // 用户确认分享后执行的回调函数
                                }
                            });
                            wx.updateTimelineShareData({
                                title: json.title, // 分享标题
                                link: json.link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                                imgUrl: json.imgUrl, // 分享图标
                                success: function () {
                                    // 用户确认分享后执行的回调函数
                                }
                            });
                            wx.onMenuShareWeibo({
                                title: json.title, // 分享标题
                                desc: json.desc, // 分享描述
                                link: json.link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                                imgUrl: json.imgUrl, // 分享图标
                                success: function () {
                                    // 用户确认分享后执行的回调函数
                                },
                                cancel: function () {
                                    // 用户取消分享后执行的回调函数
                                }
                            });
                            wx.error(function (res) {
                            });
                        });
                    } else if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        var shareInfo = {};
                        shareInfo.title = json.title || "";
                        shareInfo.desc = json.desc || "";
                        shareInfo.link = json.link || "";
                        shareInfo.icon = json.imgUrl || "";

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "Share", data: shareInfo }));
                        } else if (window.Share) {
                            window.Share.postMessage(JSON.stringify(shareInfo));
                        }
                    }

                    return;
                },

                /**
                 * 获取经纬度
                 * @param callback
                 */
                getLocation: function getLocation(callback) {

                    // 10秒钟内不再从高德接口拿数据
                    var timestamp = parseInt(new Date().getTime() / 1000);
                    if (!FPHDSdk.dataIsNull(amapLocationInfo.time) && !FPHDSdk.dataIsNull(amapLocationInfo.latitude) && !FPHDSdk.dataIsNull(amapLocationInfo.longitude)) {
                        if (timestamp <= amapLocationInfo.time + 10) {
                            var info = {};
                            info["latitude"] = amapLocationInfo.latitude; // 纬度，浮点数，范围为90 ~ -90
                            info["longitude"] = amapLocationInfo.longitude; // 经度，浮点数，范围为180 ~ -180。

                            callback(info);
                            return;
                        }
                    }

                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'fphdApp' || browserType == 'fphdNewApp') {

                        FPHDSdk.addEventListener('amapLocation', callback);

                        var fpapp = typeof webkit !== 'undefined' ? window.webkit.messageHandlers.FPApp : window.FPApp;
                        if (fpapp) {
                            fpapp.postMessage(JSON.stringify({ action: "GetLocation" }));
                        } else if (window.GetLocation) {
                            window.GetLocation.postMessage("");
                        }

                    } else {

                        FPHDSdk._webGetLocation(callback);
                    }

                    return;
                },

                /**
                 * 通过web获取经纬度
                 * @param callback
                 */
                _webGetLocation: function _webGetLocation(callback) {

                    var timestamp = parseInt(new Date().getTime() / 1000);
                    console.log("获取经纬度 getLocation 开始时间: " + new Date().getTime());

                    //*
                    var browserType = FPHDSdk.getBrowserType();
                    if (browserType == 'weixin') {

                        weixinJsConfig.jsApiList = [
                            "getLocation",
                            'openLocation'
                        ];

                        console.log("开始获取微信定位");

                        wx.config(weixinJsConfig);
                        wx.ready(function () {
                            wx.getLocation({
                                type: 'gcj02', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
                                success: function (res) {

                                    console.log("微信定位获取成功", res);

                                    var info = {};
                                    info["latitude"] = res.latitude; // 纬度，浮点数，范围为90 ~ -90
                                    info["longitude"] = res.longitude; // 经度，浮点数，范围为180 ~ -180。

                                    amapLocationInfo.time = timestamp;
                                    amapLocationInfo.latitude = res.latitude;
                                    amapLocationInfo.longitude = res.longitude;

                                    console.log("获取经纬度 getLocation 结束时间: " + new Date().getTime());

                                    callback(info);
                                },
                                fail: function (res) {

                                    console.log("微信定位获取失败", res);
                                    console.log("开始获取腾讯地图定位");

                                    var options = { timeout: 3000, failTipFlag: false };
                                    var geolocation = new qq.maps.Geolocation(qqMapKey, qqMapAppName);
                                    geolocation.getLocation(function (position) {

                                        console.log('腾讯地图定位: ', position);
                                        var info = {};
                                        info["latitude"] = position.lat; // 纬度，浮点数，范围为90 ~ -90
                                        info["longitude"] = position.lng; // 经度，浮点数，范围为180 ~ -180。

                                        amapLocationInfo.time = timestamp;
                                        amapLocationInfo.latitude = position.lat;
                                        amapLocationInfo.longitude = position.lng;
                                        amapLocationInfo.adcode = parseInt(position.adcode / 100) * 100;
                                        amapLocationInfo.city = position.city;

                                        console.log("获取经纬度 getLocation 结束时间: " + new Date().getTime());

                                        callback(info);
                                    }, function () {

                                        console.log("腾讯地图定位获取失败");

                                        geolocation.getIpLocation(function (position) {

                                            console.log('腾讯地图IP定位: ', position);
                                            var info = {};
                                            info["latitude"] = position.lat; // 纬度，浮点数，范围为90 ~ -90
                                            info["longitude"] = position.lng; // 经度，浮点数，范围为180 ~ -180。

                                            amapLocationInfo.time = timestamp;
                                            amapLocationInfo.latitude = position.lat;
                                            amapLocationInfo.longitude = position.lng;
                                            amapLocationInfo.adcode = parseInt(position.adcode / 100) * 100;
                                            amapLocationInfo.city = position.city;

                                            console.log("获取经纬度 getLocation 结束时间: " + new Date().getTime());

                                            callback(info);
                                        }, function () {
                                            var info = {};
                                            info["latitude"] = 0; // 纬度，浮点数，范围为90 ~ -90
                                            info["longitude"] = 0; // 经度，浮点数，范围为180 ~ -180。

                                            callback(info);
                                        });

                                    }, options);

                                }
                            });
                        });

                    } else {

                        console.log("开始获取腾讯地图定位");

                        var options = { timeout: 3000, failTipFlag: false };
                        var geolocation = new qq.maps.Geolocation(qqMapKey, qqMapAppName);
                        //var geolocation = new qq.maps.Geolocation();
                        geolocation.getLocation(function (position) {

                            console.log('腾讯地图定位: ', position);
                            var info = {};
                            info["latitude"] = position.lat; // 纬度，浮点数，范围为90 ~ -90
                            info["longitude"] = position.lng; // 经度，浮点数，范围为180 ~ -180。

                            amapLocationInfo.time = timestamp;
                            amapLocationInfo.latitude = position.lat;
                            amapLocationInfo.longitude = position.lng;
                            amapLocationInfo.adcode = parseInt(position.adcode / 100) * 100;
                            amapLocationInfo.city = position.city;

                            console.log("获取经纬度 getLocation 结束时间: " + new Date().getTime());

                            callback(info);
                        }, function () {

                            console.log("腾讯地图定位获取失败");

                            geolocation.getIpLocation(function (position) {

                                console.log('腾讯地图IP定位: ', position);
                                var info = {};
                                info["latitude"] = position.lat; // 纬度，浮点数，范围为90 ~ -90
                                info["longitude"] = position.lng; // 经度，浮点数，范围为180 ~ -180。

                                amapLocationInfo.time = timestamp;
                                amapLocationInfo.latitude = position.lat;
                                amapLocationInfo.longitude = position.lng;
                                amapLocationInfo.adcode = parseInt(position.adcode / 100) * 100;
                                amapLocationInfo.city = position.city;

                                console.log("获取经纬度 getLocation 结束时间: " + new Date().getTime());

                                callback(info);
                            }, function () {
                                var info = {};
                                info["latitude"] = 0; // 纬度，浮点数，范围为90 ~ -90
                                info["longitude"] = 0; // 经度，浮点数，范围为180 ~ -180。

                                callback(info);
                            });

                        }, options);
                    }
                    // */


                    /*
                    var browserType = FPHDSdk.getBrowserType();
                    var mapObj = new AMap.Map('iCenter');
                    mapObj.plugin('AMap.Geolocation', function () {
                        var geolocation = new AMap.Geolocation({
                            enableHighAccuracy: true,//是否使用高精度定位，默认:true
                            timeout: 3000,          //超过10秒后停止定位，默认：无穷大
                            maximumAge: 0,           //定位结果缓存0毫秒，默认：0
                            noIpLocate: 0,
                            convert: true,           //自动偏移坐标，偏移后的坐标为高德坐标，默认：true
                            showButton: true,        //显示定位按钮，默认：true
                            buttonPosition: 'LB',    //定位按钮停靠位置，默认：'LB'，左下角
                            buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
                            showMarker: true,        //定位成功后在定位到的位置显示点标记，默认：true
                            showCircle: true,        //定位成功后用圆圈表示定位精度范围，默认：true
                            panToLocation: true,     //定位成功后将定位到的位置作为地图中心点，默认：true
                            zoomToAccuracy: true      //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
                        });
                        //mapObj.addControl(geolocation);
                        geolocation.getCurrentPosition(function (status, result) {
                            if (status == 'complete') {
                                console.log('高德定位: ', result);
                                var info = {};
                                info["latitude"] = result.position.lat; // 纬度，浮点数，范围为90 ~ -90
                                info["longitude"] = result.position.lng; // 经度，浮点数，范围为180 ~ -180。

                                amapLocationInfo.time = timestamp;
                                amapLocationInfo.latitude = result.position.lat;
                                amapLocationInfo.longitude = result.position.lng;

                                console.log("获取经纬度 getLocation 结束时间: " + new Date().getTime());

                                callback(info);
                            } else {
                                console.log('高德定位失败');
                                if (browserType == 'weixin') {

                                    weixinJsConfig.jsApiList = [
                                        "getLocation",
                                        'openLocation'
                                    ];

                                    console.log("开始获取微信定位");

                                    wx.config(weixinJsConfig);
                                    wx.ready(function () {
                                        wx.getLocation({
                                            type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
                                            success: function (res) {

                                                console.log("微信定位获取成功", res);

                                                var info = {};
                                                info["latitude"] = res.latitude; // 纬度，浮点数，范围为90 ~ -90
                                                info["longitude"] = res.longitude; // 经度，浮点数，范围为180 ~ -180。

                                                amapLocationInfo.time = timestamp;
                                                amapLocationInfo.latitude = res.latitude;
                                                amapLocationInfo.longitude = res.longitude;

                                                console.log("获取经纬度 getLocation 结束时间: " + new Date().getTime());

                                                callback(info);
                                            },
                                            fail: function (res) {

                                                console.log("微信定位获取失败", res);

                                                var info = {};
                                                info["latitude"] = 0; // 纬度，浮点数，范围为90 ~ -90
                                                info["longitude"] = 0; // 经度，浮点数，范围为180 ~ -180。

                                                callback(info);
                                            }
                                        });
                                    });
                                } else {
                                    var info = {};
                                    info["latitude"] = 0; // 纬度，浮点数，范围为90 ~ -90
                                    info["longitude"] = 0; // 经度，浮点数，范围为180 ~ -180。

                                    callback(info);
                                }
                            }
                        });
                    });
                    // */

                },

                /**
                 * 获取当前所在城市
                 * @param callback
                 */
                getNowCity: function getNowCity(callback) {

                    var returnData = {};
                    returnData["adcode"] = 0;
                    returnData["city"] = "";

                    // 10秒钟内不再从高德接口拿数据
                    var timestamp = parseInt(new Date().getTime() / 1000);
                    if (!FPHDSdk.dataIsNull(amapLocationInfo.time) && !FPHDSdk.dataIsNull(amapLocationInfo.adcode) && !FPHDSdk.dataIsNull(amapLocationInfo.city)) {
                        if (timestamp <= amapLocationInfo.time) {
                            returnData["adcode"] = amapLocationInfo.adcode;
                            returnData["city"] = amapLocationInfo.city;

                            callback(returnData);
                            return;
                        }
                    }

                    //*
                    FPHDSdk.getLocation(function (json) {

                        if (json.longitude == 0 || json.latitude == 0) {
                            callback(returnData);
                            return;
                        }

                        var postUrl = apiServerUrl + "/lbs/getCity?lng=" + json.longitude + "&lat=" + json.latitude + "&channelId=" + channelId;
                        FPHDSdk.doGet({
                            url: postUrl,
                            onSuccess: function (data) {

                                var dataObj = eval("(" + data.response + ")");//转换为json对象
                                if (dataObj.code != 0) {
                                    callback(returnData);
                                    return;
                                } else {

                                    amapLocationInfo.time = timestamp;
                                    amapLocationInfo.adcode = dataObj.data.adcode;
                                    amapLocationInfo.city = dataObj.data.city;

                                    returnData["adcode"] = dataObj.data.adcode;
                                    returnData["city"] = dataObj.data.city;
                                    callback(returnData);
                                    return;
                                }

                            },
                            onFail: function () {
                                callback(returnData);
                                return;
                            }
                        });
                    });
                    // */

                    /*
                    FPHDSdk.getLocation(function (json) {

                        if (json.longitude == 0 || json.latitude == 0) {
                            callback(returnData);
                            return;
                        }

                        FPHDSdk.getNearbyList(json, function (result) {
                            if (result.code != 0 || result.data.length < 1) {
                                callback(returnData);
                                return;
                            }

                            var postUrl = "https://restapi.amap.com/v3/config/district?keywords=" + result.data[0].cityname + "&subdistrict=0&key=" + gaodeKey;
                            FPHDSdk.doGet({
                                url: postUrl,
                                onSuccess: function (data) {
                                    var dataObj = eval("(" + data.response + ")");//转换为json对象

                                    if (dataObj.status != 1) {
                                        callback(returnData);
                                        return;
                                    } else {

                                        console.log("获取当前所在城市 getNowCity 结束时间: " + new Date().getTime());

                                        amapLocationInfo.time = timestamp;
                                        amapLocationInfo.adcode = dataObj.districts[0].adcode;
                                        amapLocationInfo.city = dataObj.districts[0].name;

                                        returnData["adcode"] = dataObj.districts[0].adcode;
                                        returnData["city"] = dataObj.districts[0].name;
                                        callback(returnData);
                                        return;
                                    }
                                },
                                onFail: function () {
                                    callback(returnData);
                                    return;
                                }
                            });

                        });

                    });
                    // */

                },

                /**
                 * 根据经纬度获取附近的地标列表
                 * @param json 格式：{longitude:108.89605,latitude:34.240883}
                 * @param callback
                 */
                getNearbyList: function getNearbyList(json, callback) {

                    var returnData = {};
                    returnData["code"] = 0;
                    returnData["msg"] = "success";
                    returnData["data"] = [];

                    if (json.longitude == 0 || json.latitude == 0) {
                        returnData["code"] = 1003;
                        returnData["msg"] = "获取不到地理位置信息";
                        callback(returnData);
                        return;
                    }

                    //*
                    var postUrl = apiServerUrl + "/lbs/getNearbyList?lng=" + json.longitude + "&lat=" + json.latitude + "&channelId=" + channelId;
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {

                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code != 0) {
                                returnData["code"] = 1001;
                                returnData["msg"] = "获取数据失败";
                                callback(returnData);
                            } else {

                                var list = [];
                                for (var i = 0; i < dataObj.data.length; i++) {
                                    var tmpData = {};
                                    tmpData["name"] = dataObj.data[i].name;
                                    tmpData["address"] = dataObj.data[i].address;
                                    tmpData["location"] = dataObj.data[i].location;
                                    tmpData["distance"] = dataObj.data[i].distance;
                                    tmpData["pname"] = dataObj.data[i].pname;
                                    tmpData["cityname"] = dataObj.data[i].cityname;
                                    tmpData["adname"] = dataObj.data[i].adname;

                                    list.push(tmpData);
                                }

                                returnData["data"] = list;
                                callback(returnData);
                            }

                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });
                    // */

                    /*
                    var postUrl = "https://restapi.amap.com/v3/place/around?key=" + gaodeKey  + "&location=" + json.longitude + "," + json.latitude;
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象

                            if (dataObj.status != 1) {

                                returnData["code"] = 1001;
                                returnData["msg"] = "获取数据失败";
                                callback(returnData);
                            } else {

                                var list = [];
                                for (var i = 0; i < dataObj.pois.length; i++) {
                                    var tmpData = {};
                                    tmpData["name"] = dataObj.pois[i].name;
                                    tmpData["address"] = dataObj.pois[i].address;
                                    tmpData["location"] = dataObj.pois[i].location;
                                    tmpData["distance"] = dataObj.pois[i].distance;
                                    tmpData["pname"] = dataObj.pois[i].pname;
                                    tmpData["cityname"] = dataObj.pois[i].cityname;
                                    tmpData["adname"] = dataObj.pois[i].adname;

                                    list.push(tmpData);
                                }

                                returnData["data"] = list;
                                callback(returnData);
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });
                    // */

                    return;
                },

                /**
                 * 根据关键词搜索地标列表
                 * @param json 格式：
                 *
                 * {
                 *     keywords:"故宫", //搜索的词
                 *     longitude:108.89605, // 经度
                 *     latitude:34.240883, // 纬度
                 *     adcode:0 // 城市码
                 * }
                 *
                 * @param callback
                 */
                lbsSearch: function lbsSearch(json, callback) {

                    var returnData = {};
                    returnData["code"] = 0;
                    returnData["msg"] = "success";
                    returnData["data"] = [];

                    var postUrl = apiServerUrl + "/lbs/search?keywords=" + json.keywords + "&lng=" + json.longitude + "&lat=" + json.latitude + "&adcode=" + json.adcode + "&channelId=" + channelId;
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code != 0) {

                                returnData["code"] = 1001;
                                returnData["msg"] = "获取数据失败";
                                callback(returnData);
                            } else {

                                var list = [];
                                for (var i = 0; i < dataObj.data.length; i++) {
                                    var tmpData = {};
                                    tmpData["name"] = dataObj.data[i].name;
                                    tmpData["address"] = dataObj.data[i].address;
                                    tmpData["location"] = dataObj.data[i].location;
                                    tmpData["district"] = dataObj.data[i].district;
                                    tmpData["adcode"] = dataObj.data[i].adcode;

                                    list.push(tmpData);
                                }

                                returnData["data"] = list;
                                callback(returnData);
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });

                    /*
                    var postUrl = apiServerUrl + "/lbs/search?keywords=" + json.keywords + "&lng=" + json.longitude + "&lat=" + json.latitude + "&adcode=" + json.adcode + "&channelId=" + channelId;
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.data.status != 1) {

                                returnData["code"] = 1001;
                                returnData["msg"] = "获取数据失败";
                                callback(returnData);
                            } else {

                                var list = [];
                                for (var i = 0; i < dataObj.data.tips.length; i++) {
                                    var tmpData = {};
                                    tmpData["name"] = dataObj.data.tips[i].name;
                                    tmpData["address"] = dataObj.data.tips[i].address;
                                    tmpData["location"] = dataObj.data.tips[i].location;
                                    tmpData["district"] = dataObj.data.tips[i].district;
                                    tmpData["adcode"] = dataObj.data.tips[i].adcode;

                                    list.push(tmpData);
                                }

                                returnData["data"] = list;
                                callback(returnData);
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            callback(returnData);
                        }
                    });
                    // */

                    return;
                },

                /**
                 * 根据经纬度坐标绘制地图
                 * @param json 格式：
                 *
                 * {
                 *     longitude:108.89605, // 经度
                 *     latitude:34.240883, // 纬度
                 *     mapDivId: "container" // 汇总地图的div id，例如：<div id="container" ></div>
                 * }
                 */
                drawMap: function drawMap(json) {

                    /*
                    var map = new AMap.Map(json.mapDivId, {
                        resizeEnable: true,
                        center:[json.longitude, json.latitude],
                        zoom:18
                    });

                    map.clearMap();
                    var marker = new AMap.Marker({
                        map: map,
                        position: [json.longitude, json.latitude]
                    });
                    // */

                    var center = new qq.maps.LatLng(json.latitude, json.longitude);
                    var map = new qq.maps.Map(document.getElementById(json.mapDivId), {
                        center: center,
                        zoom: 18

                    });

                    var anchor = new qq.maps.Point(6, 6),
                        size = new qq.maps.Size(24, 24),
                        origin = new qq.maps.Point(0, 0),
                        icon = new qq.maps.MarkerImage('https://mapapi.qq.com/web/lbs/javascriptV2/demo/img/center.gif', size, origin, anchor);
                    var marker = new qq.maps.Marker({
                        icon: icon,
                        map: map,
                        position: map.getCenter()
                    });

                },

                // 游戏APP分享
                gameAppShare: function gameAppShare(obj) {
                    if (FPHDSdk.dataIsNull(obj.token) || FPHDSdk.dataIsNull(obj.channelId) || FPHDSdk.dataIsNull(obj)) {
                        return;
                    }
                    var postUrl = apiServerUrl + "/User/isSubscribe?token=" + obj.token + "&channelId=" + obj.channelId;
                    FPHDSdk.doGet({
                        url: postUrl,
                        onSuccess: function (data) {
                            var dataObj = eval("(" + data.response + ")");//转换为json对象
                            if (dataObj.code != 0) {

                                returnData["code"] = 1001;
                                returnData["msg"] = "获取数据失败";
                                return returnData;
                            } else {

                                if (dataObj.data.status == 0) {
                                    window.location.href = apiServerUrl + "/Game/AppShare?token=" + obj.token;
                                    // var iframeUrl = apiServerUrl + "/Game/AppShare?token=" + obj.token;
                                    // var html = '<iframe scrolling="auto" src="' + iframeUrl + '" style="border: 0px; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;z-index: 1000;" name="gameAppShareDivIframe" id="phoneLoginDivIframe"></iframe>';
                                    //
                                    // FPHDSdk._createBaseElement(html);
                                    return;
                                }

                                if (dataObj.data.hasPhone == 0) {
                                    window.location.href = apiServerUrl + "/user/Login/bindPhone?channelId=" + obj.channelId;
                                    return;
                                }
                                return;
                            }
                        },
                        onFail: function () {
                            returnData["code"] = 1002;
                            returnData["msg"] = "请求服务器失败";
                            return;
                        }
                    })
                },

            };
        }

    ]);
});

window.addEventListener("message", FPHDSdk._iframeEventListener);
